import urllib.request as ur
import urllib.parse as up
import json

# 百度翻译爬虫案例
data = {
    'kw':'Python',
}
data_url = up.urlencode(data)
request = ur.Request(
    url='https://fanyi.baidu.com/sug',
    data = data_url.encode('utf-8')
)
response = ur.urlopen(request).read()
print(response)

ret = json.loads(response)
print(ret)
